﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace GNCMedia.KQXS.Service
{

    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name = "ContentRoutingSoap", Namespace = "http://content.routing.gncmedia.vn/")]
    public partial class ContentRouting : System.Web.Services.Protocols.SoapHttpClientProtocol
    {

        private System.Threading.SendOrPostCallback MOReceiveOperationCompleted;

        private System.Threading.SendOrPostCallback SendMTOperationCompleted;

        /// <remarks/>
        public ContentRouting()
        {
            this.Url = "http://115.84.179.253:81/ContentRouting/ContentRouting.asmx";
        }

        /// <remarks/>
        public event MOReceiveCompletedEventHandler MOReceiveCompleted;

        /// <remarks/>
        public event SendMTCompletedEventHandler SendMTCompleted;

        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://content.routing.gncmedia.vn/MOReceive", RequestNamespace = "http://content.routing.gncmedia.vn/", ResponseNamespace = "http://content.routing.gncmedia.vn/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public void MOReceive(string src, string dest, string moseq, string cmdcode, string msgbody, string username, string password)
        {
            this.Invoke("MOReceive", new object[] {
                    src,
                    dest,
                    moseq,
                    cmdcode,
                    msgbody,
                    username,
                    password});
        }

        /// <remarks/>
        public System.IAsyncResult BeginMOReceive(string src, string dest, string moseq, string cmdcode, string msgbody, string username, string password, System.AsyncCallback callback, object asyncState)
        {
            return this.BeginInvoke("MOReceive", new object[] {
                    src,
                    dest,
                    moseq,
                    cmdcode,
                    msgbody,
                    username,
                    password}, callback, asyncState);
        }

        /// <remarks/>
        public void EndMOReceive(System.IAsyncResult asyncResult)
        {
            this.EndInvoke(asyncResult);
        }

        /// <remarks/>
        public void MOReceiveAsync(string src, string dest, string moseq, string cmdcode, string msgbody, string username, string password)
        {
            this.MOReceiveAsync(src, dest, moseq, cmdcode, msgbody, username, password, null);
        }

        /// <remarks/>
        public void MOReceiveAsync(string src, string dest, string moseq, string cmdcode, string msgbody, string username, string password, object userState)
        {
            if ((this.MOReceiveOperationCompleted == null))
            {
                this.MOReceiveOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMOReceiveOperationCompleted);
            }
            this.InvokeAsync("MOReceive", new object[] {
                    src,
                    dest,
                    moseq,
                    cmdcode,
                    msgbody,
                    username,
                    password}, this.MOReceiveOperationCompleted, userState);
        }

        private void OnMOReceiveOperationCompleted(object arg)
        {
            if ((this.MOReceiveCompleted != null))
            {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.MOReceiveCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }

        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://content.routing.gncmedia.vn/SendMT", RequestNamespace = "http://content.routing.gncmedia.vn/", ResponseNamespace = "http://content.routing.gncmedia.vn/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public int SendMT(string shortcode, string msisdn, int mtseq, string msgtype, string msgtitle, string msgbody, string moseq, int procresult, int mttotalseg, int mtsegref)
        {
            object[] results = this.Invoke("SendMT", new object[] {
                    shortcode,
                    msisdn,
                    mtseq,
                    msgtype,
                    msgtitle,
                    msgbody,
                    moseq,
                    procresult,
                    mttotalseg,
                    mtsegref});
            return ((int)(results[0]));
        }

        /// <remarks/>
        public System.IAsyncResult BeginSendMT(string shortcode, string msisdn, int mtseq, string msgtype, string msgtitle, string msgbody, string moseq, int procresult, int mttotalseg, int mtsegref, System.AsyncCallback callback, object asyncState)
        {
            return this.BeginInvoke("SendMT", new object[] {
                    shortcode,
                    msisdn,
                    mtseq,
                    msgtype,
                    msgtitle,
                    msgbody,
                    moseq,
                    procresult,
                    mttotalseg,
                    mtsegref}, callback, asyncState);
        }

        /// <remarks/>
        public int EndSendMT(System.IAsyncResult asyncResult)
        {
            object[] results = this.EndInvoke(asyncResult);
            return ((int)(results[0]));
        }

        /// <remarks/>
        public void SendMTAsync(string shortcode, string msisdn, int mtseq, string msgtype, string msgtitle, string msgbody, string moseq, int procresult, int mttotalseg, int mtsegref)
        {
            this.SendMTAsync(shortcode, msisdn, mtseq, msgtype, msgtitle, msgbody, moseq, procresult, mttotalseg, mtsegref, null);
        }

        /// <remarks/>
        public void SendMTAsync(string shortcode, string msisdn, int mtseq, string msgtype, string msgtitle, string msgbody, string moseq, int procresult, int mttotalseg, int mtsegref, object userState)
        {
            if ((this.SendMTOperationCompleted == null))
            {
                this.SendMTOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSendMTOperationCompleted);
            }
            this.InvokeAsync("SendMT", new object[] {
                    shortcode,
                    msisdn,
                    mtseq,
                    msgtype,
                    msgtitle,
                    msgbody,
                    moseq,
                    procresult,
                    mttotalseg,
                    mtsegref}, this.SendMTOperationCompleted, userState);
        }

        private void OnSendMTOperationCompleted(object arg)
        {
            if ((this.SendMTCompleted != null))
            {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.SendMTCompleted(this, new SendMTCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }

        /// <remarks/>
        public new void CancelAsync(object userState)
        {
            base.CancelAsync(userState);
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    public delegate void MOReceiveCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    public delegate void SendMTCompletedEventHandler(object sender, SendMTCompletedEventArgs e);

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class SendMTCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
    {

        private object[] results;

        internal SendMTCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
            base(exception, cancelled, userState)
        {
            this.results = results;
        }

        /// <remarks/>
        public int Result
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((int)(this.results[0]));
            }
        }
    }
}